import fs from 'fs';

const readStream = fs.createReadStream('./aaa.txt', {
    start: 8, 
    end: 22, 
    highWaterMark: 3
});

readStream.on('data', (data) => {
    console.log(data.toString());
   });
   
   readStream.on('end', () => {
    console.log('已经读取到end位置');
   });
   
   readStream.on('close', () => {
    console.log('文件读取结束, 并且被关闭');
   });
   